﻿using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms;

namespace Marmat.Forms
{
    public partial class TopicBarItem
    {

        /* TODO ERROR: Skipped RegionDirectiveTrivia */    // <Browsable(False)>
                                                           // Public ReadOnly Property TopicBar As TopicBar
                                                           // Get
                                                           // If Me.TopicBarPage IsNot Nothing Then
                                                           // Return Me.TopicBarPage.TopicBar
                                                           // End If
                                                           // Return Nothing
                                                           // End Get
                                                           // End Property

        internal TopicBarPage _TopicBarPage;

        [Browsable(false)]
        public TopicBarPage TopicBarPage
        {
            get
            {
                return this._TopicBarPage;
            }
        }

        private string _Name;
        /// <summary>
    /// 获取或设置项的名称
    /// </summary>
        [DefaultValue(null)]
        [RefreshProperties(RefreshProperties.All)]
        [Description("获取或设置项的名称")]
        public string Name
        {
            get
            {
                return this._Name;
            }

            set
            {
                this._Name = value;
            }
        }

        private string _Text = null;
        /// <summary>
    /// 获取或设置项的文本
    /// </summary>
        [Description("获取或设置项的文本")]
        public string Text
        {
            get
            {
                if (this._Text is null)
                {
                    return this.Name;
                }

                return this._Text;
            }

            set
            {
                this._Text = value;
                this.Method_Invalidate();
            }
        }

        private Image _Image = null;
        internal Image _EnabledImage;
        /// <summary> Item 显示的图标</summary>
        [DefaultValue(null)]
        [Description("Item 显示的图标")]
        [MergableProperty(true)]
        [Localizable(true)]
        [Editor(typeof(ImageEditor), typeof(UITypeEditor))]
        public Image Image
        {
            get
            {
                return this._Image;
            }

            set
            {
                this._Image = value;
                if (value is object)
                {
                    this._EnabledImage = (Image)value.Clone();
                    ControlPaint.DrawImageDisabled(Graphics.FromImage(this._EnabledImage), this._EnabledImage, 0, 0, Color.Transparent);
                }

                this.Method_Invalidate();
            }
        }

        private object _Tag = null;
        /// <summary> 获取或设置包含有关控件的数据的对象。  </summary>
        [Browsable(false)]
        [DefaultValue(null)]
        [Description("获取或设置包含有关控件的数据的对象")]
        [MergableProperty(true)]
        public object Tag
        {
            get
            {
                return this._Tag;
            }

            set
            {
                this._Tag = value;
            }
        }

        private bool _Visible = true;
        /// <summary>
    /// 返回或设置是否显示
    /// </summary>
        [DefaultValue(true)]
        public bool Visible
        {
            get
            {
                return this._Visible;
            }

            set
            {
                this._Visible = value;
            }
        }

        private bool _Enabled = true;
        /// <summary> 当前 Item 是否可用 </summary>
        [DefaultValue(true)]
        [Description("当前 Item 是否可用")]
        [MergableProperty(true)]
        public bool Enabled
        {
            get
            {
                return this._Enabled;
            }

            set
            {
                this._Enabled = value;
                this.Method_Invalidate();
            }
        }

        private MouseStateEnum _MouseState;
        /// <summary> Item 当前的鼠标状态</summary>
        internal MouseStateEnum MouseState
        {
            get
            {
                return this._MouseState;
            }

            set
            {
                if (this._MouseState != value)
                {
                    this._MouseState = value;
                    this.Method_Invalidate();
                }
            }
        }

        private Rectangle m_Rectangle;
        /// <summary> 当前 Page 在 NavigateBar 中的 Rectangle </summary>
        internal Rectangle Rectangle
        {
            get
            {
                return this.m_Rectangle;
            }

            set
            {
                this.m_Rectangle = value;
            }
        }
        /* TODO ERROR: Skipped EndRegionDirectiveTrivia */
        /* TODO ERROR: Skipped RegionDirectiveTrivia */
        private void Method_Invalidate()
        {
            // If Me.TopicBar IsNot Nothing Then
            // Me.TopicBar.Invalidate(Me.Rectangle)
            // End If
        }
        /* TODO ERROR: Skipped EndRegionDirectiveTrivia */
    }
}